package net.wofly.sale.stock.service.impl;

import net.wofly.sale.stock.domain.StockWarning;
import net.wofly.sale.stock.repository.StockWarningRepository;
import net.wofly.sale.stock.service.IStockWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service("iStockWarningService")
@Transactional
public class StockWarningServiceImpl implements IStockWarningService {
    
    @Autowired
    StockWarningRepository stockWarningRepository;
    
    @Override
    public StockWarning save(StockWarning entity) {
        return stockWarningRepository.save(entity);
    }
    
    @Override
    public void delete(StockWarning entity) {
        stockWarningRepository.delete(entity);
    }
    
    @Override
    public void delete(String key) {
        stockWarningRepository.delete(key);
    }
    
    @Override
    public StockWarning findOne(String key) {
        return stockWarningRepository.findOne(key);
    }
    
    @Override
    public Page<StockWarning> findAll(Specification specification, Pageable pageable) {
        return stockWarningRepository.findAll(specification, pageable);
    }
    
    @Override
    public List<StockWarning> save(List<StockWarning> entityList) {
        return (List<StockWarning>) stockWarningRepository.save(entityList);
    }
}
